<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <ul id="users">

    </ul>
</body>
<script>
    fetch("http://localhost:8081/getlist")
        .then(res => res.json())  //说明响应数据的结构
        .then(res => {
            console.log(res)
            var userList = res
            var users = document.getElementById('users')
            for (var i = 0; i < userList.length; i++) {
                var liNode = document.createElement('li')
                liNode.innerHTML = '<span>' + userList[i]['username'] + '</span>'+
                                    '&nbsp;&nbsp;<span>'+userList[i]['age']+'</span>'+
                                    '&nbsp;&nbsp;<span>'+userList[i]['choose']+'</span>'+
                                    "&nbsp;&nbsp;<a href='/del?deluser="+userList[i]['username']+"'>删除</a>"
                users.append(liNode)
            }
            
        })
</script>

</html>